// Learn cc.Class:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html


import uiPanel from "./../../lib/UiPanel";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NotEnoughCoin extends uiPanel {
  @property(cc.Label)
  needCoin: cc.Label = null;

  _isNeedStandUp = false;
  _isInGame = false;
  onLoad() {
    this._isNeedStandUp = true; //需要站起
    this._isInGame = true; //是否在游戏中
  }
  init(regs) {
    this._isNeedStandUp = regs[0].isNeedStandUp; //需要站起
    this._isInGame = regs[0].isInGame; //是否在游戏中
    this.needCoin.string = "当前房间需要" + regs[0].needCoin + "才可进入，是否立刻充值？";//;
  }
  setNeedStandUp(tag) {
    this._isNeedStandUp = tag;
  }
  setIsInGame(tag) {
    this._isInGame = tag; //

  }
  onCLickBuy(event) {
    cc.vv.audioUtil.playSound("Hall/sound/button_onclicked");
    if (this._isInGame) {
      if (this._isNeedStandUp) {
        cc.vv.eventCustom.emit("LeaveTable", true);
        return;
      }
    }
    cc.vv.UIMgr.close(cc.vv.GLConfig.notEnoughCoin_path, cc.vv.UIMgr.closeType.destory);
    cc.vv.GLUtils.backHallOpenRecharge(event.target.name === "Buy");
  }





}
